<!DOCTYPE html>
<html lang="zh" style="background-color: #fff;" >
<head>
<meta charset="utf-8" />
<title>数据门户数据查看</title> 
<link href="${mvcPath}/dacp-lib/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" media="screen"/>	
<link href="${mvcPath}/dacp-view/aijs/css/ai.css" type="text/css" rel="stylesheet" />
<link href="${mvcPath}/dacp-res/catalog/common/css/ai.meta.css" type="text/css" rel="stylesheet"/>
<link href="${mvcPath}/dacp-lib/fuelux/fuelux.min.css" type="text/css" rel="stylesheet" media="screen"/>
<script type="text/javascript" src="${mvcPath}/dacp-lib/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="${mvcPath}/dacp-lib/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${mvcPath}/dacp-lib/underscore/underscore-min.js"></script>
<script src="${mvcPath}/dacp-lib/fuelux/fuelux.min.js"></script>
<script src="${mvcPath}/dacp-lib/cryptojs/aes.js" type="text/javascript"></script>
<script src="${mvcPath}/crypto/crypto-context.js" type="text/javascript"></script>
<script src="${mvcPath}/dacp-view/aijs/js/ai.core.js"></script>
<script src="${mvcPath}/dacp-view/aijs/js/ai.field.js"></script>
<script src="${mvcPath}/dacp-view/aijs/js/ai.grid.js"></script>
<script src="${mvcPath}/dacp-view/aijs/js/ai.jsonstore.js"></script>
<script src="${mvcPath}/dacp-view/aijs/js/ai.grid.ux.js"></script>
<style>
</style>
<script>
$(document).ready(function() {
	var sql = "select OPTIME,KPI_CODE,KPI_NAME,KPI_CYCLE,KPI_VALUE,PRE_DVALUE,PRE_MVALUE,DRATE,MRATE from dacp_kpi_value";
	var valueStore = new AI.JsonStore({
		sql:sql,
		pageSize:20,
		table:"dacp_kpi_value",
		key:"KPI_CODE"
	});
	var queryNotice = function(){
		var qtitle = $("#q_notice_title").val();
		var qtime = $("#myDatepickerInput").val();
		var year = qtime.substring(qtime.lastIndexOf("/")+1);
		qtime = qtime.substring(0,qtime.lastIndexOf("/"));
		qtime = year+"/"+qtime;
		var newsql = "select OPTIME,KPI_CODE,KPI_NAME,KPI_CYCLE,KPI_VALUE,PRE_DVALUE,PRE_MVALUE,DRATE,MRATE from dacp_kpi_value where OPTIME='"+qtime+"' and (KPI_CODE like '%"+qtitle+"%' or KPI_NAME like '"+qtitle+"')";
		valueStore.select(newsql);
		valueList.reload();
	}
	var config = {
		containerId:"portalvalueinfo",
		title:"数据展示",
		store:valueStore,
		show:true,
		showcheck:false, 
		viewtype:"list",
		card:{},
		columns:[{header : "数据时间", dataIndex : "OPTIME", width : "13%", sortable: true}, 
				{header : "指标编码", dataIndex : "KPI_CODE", width : "13%", sortable: true},
				{header : "指标名称", dataIndex : "KPI_NAME", width : "13%", sortable: true},
				//{header : "周期", dataIndex : "KPI_CYCLE", width : "11%", sortable: true},
				{header : "指标值", dataIndex : "KPI_VALUE", width : "13%", sortable: true},
				{header : "上一天的值", dataIndex : "PRE_DVALUE", width : "12%", sortable: true},
				{header : "上一月的值", dataIndex : "PRE_MVALUE", width : "12%", sortable: true},
				{header : "环比", dataIndex : "DRATE", width : "12%", sortable: true,render:function(a,b){if(b!=null)return b*100+"%";}},
				{header : "同比", dataIndex : "MRATE", width : "12%", sortable: true,render:function(a,b){if(b!=null)return b*100+"%";}}
				],
		toolbarconfig:[
		      			{type:'text',fieldLabel:'输入指标编码或名称',width:120,name:'q_notice_title'},
		      			{type:'date',fieldLabel:'时间',width:120,name:'q_notice_time'},
		      			{type:'button',fieldLabel:'查询',id:'queryNotice',width:120,fn:queryNotice}
		        	  ]
	};
	$("#portalvalueinfo").empty();
	var valueList = new AI.GridUx(config);
});
</script>
</head>
<body  style="height:100%">
	<div class="frame-main" style="top:0px;position: absolute;left: 0px;right: 0px;bottom:0px;overflow:hidden">
       <div id="portalvalueinfo"  style="height:100%;"></div>
	</div>
</body>
</html>